{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "scalar min, max = 0.0 3.0\n"
     ]
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "7d46b4f8f51940f095d435bcc1ef9a47",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Plot(antialias=3, axes=['x', 'y', 'z'], background_color=16777215, camera=[4.5, 4.5, 4.5, 0.0, 0.0, 0.0, 1.0, …"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Make a Volume from a numpy object\n",
    "#\n",
    "from __future__ import print_function, division\n",
    "import numpy as np\n",
    "from vtkplotter import *\n",
    "\n",
    "X, Y, Z = np.mgrid[:30, :30, :30]\n",
    "# scaled distance from the center at (15, 15, 15)\n",
    "scalar_field = ((X-15)**2 + (Y-15)**2 + (Z-15)**2)/225\n",
    "print('scalar min, max =', np.min(scalar_field), np.max(scalar_field))\n",
    "\n",
    "vol = Volume(scalar_field)\n",
    "lego = vol.legosurface(vmin=1, vmax=2)\n",
    "\n",
    "#show(vol)\n",
    "show(lego)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
